package org.dreamwork.jasmine2.web.controls.datagrid;

import org.dreamwork.jasmine2.javac.JasmineCreator2;
import org.dreamwork.jasmine2.parser.ParseException;
import org.dreamwork.jasmine2.parser.Tag;
import org.dreamwork.jasmine2.template.CodeContext;
import org.dreamwork.jasmine2.template.ITemplateCreator;

import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: seth.yang
 * Date: 2010-10-15
 * Time: 15:05:36
 */
public class DataGridTemplateCreator implements ITemplateCreator {
    public void create (Class controlClass, CodeContext context, Tag template, String controlName) throws ParseException {
        System.out.println (template);
        JasmineCreator2 creator = context.getCreator ();
        for (Tag tag : template.getChildren ()) {
            String name = tag.getName ();
            if (name.equalsIgnoreCase ("colgroup")) {
                try {
                    creator.parseTag (tag);
                } catch (IOException e) {
                    e.printStackTrace ();
                    throw new ParseException (e);
                }
            }

        }
    }
}
